home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_087 / memwatch / memsup.a next >
Text File  |  1992-05-06  |  1KB  |  47 lines

  1.     csect    text,0,,1,2
  2.  
  3.     xdef    _SaveMem
  4.     xdef    _ValidateMem
  5.  
  6. *** this is the number of LONGWORDS at the start of memory to be checked
  7. MEMSAVESIZE    equ    64
  8. *************************************************************************
  9. * Validate the current memory information and put up an alert if it is
  10. * in sad shape
  11. *************************************************************************
  12. _ValidateMem:
  13.     movem.L    A0/A1,-(A7)
  14.     moveq.l    #MEMSAVESIZE,D0
  15.     LEA    0,A0
  16.     LEA    savearea(PC),A1
  17. checkit:
  18.     cmp.l    (A0)+,(A1)+
  19.     dbne    D0,checkit
  20.     addq    #1,D0
  21.     beq    allok
  22. * restore what got scrod
  23. *    first format the message to be printed
  24. *    we get a pointer to the address and the data portion
  25.     move.l    -(A0),D0    get the value that was put in
  26.     move.l    -(A1),(A0)    and replace with what should have been there
  27.     move.l    12(A7),A1    point to where we should save the result
  28.     move.l    D0,(A1)        save the value
  29.     move.l    A0,4(A1)    and the address for the routine to munge
  30.     moveq.l    #1,D0        set a result value to indicate failure
  31. allok:
  32.     movem.l    (a7)+,A0/A1
  33.     rts
  34.  
  35. _SaveMem:
  36.     movem.L    D0/A0/A1,-(A7)
  37.     moveq.l    #MEMSAVESIZE,D0
  38.     LEA    0,A0
  39.     LEA    savearea(PC),A1
  40. savelp:
  41.     move.l    (A0)+,(A1)+
  42.     DBF    D0,savelp
  43.     movem.l    (A7)+,D0/A0/A1
  44.     rts
  45. savearea    ds.l    MEMSAVESIZE+2    ;for save and compare of memory
  46.     END
  47.